package com.ai.analysis;

import com.ai.analysis.json.BaikeRead;
import com.ai.analysis.json.IJsonRead;
import com.ai.analysis.json.WeatherRead;
import com.alibaba.fastjson.JSONObject;

public class JsonReader {

	public String readQuery(JSONObject json) {
		String service = json.getString("service");
		IJsonRead jr = null;
		switch (service) {
		case "weather":
			jr = new WeatherRead();
			break;
		default:
			break;
		}
		return jr.readQuery(json);
	}
	
	public String readAnswer(JSONObject json) {
		String service = json.getString("service");
		IJsonRead jr = null;
		switch (service) {
		case "baike":
			jr = new BaikeRead();
			break;
		default:
			break;
		}
		return jr.readAnswer(json);
	}

}
